import java.util.ArrayList;
import java.util.Scanner;
import java.util.Stack;

public class Day1 {

    //1.数字统计
    public static void main1(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        while (in.hasNextInt()) { // 注意 while 处理多个 case
            int a = in.nextInt();//[a,b]
            int b = in.nextInt();
            int count=0;
            for(int i=a;i<=b;i++) {
                int tmp = i;
                while(tmp !=0) {
                    if(tmp%10 == 2) {
                        count++;
                    }
                    tmp/=10;
                }
            }

            System.out.println(count);
        }
    }
    //2.两个数组的交集
    public ArrayList<Integer> intersection (ArrayList<Integer> nums1, ArrayList<Integer> nums2) {
        // write code here
        int[] map = new int[1001];
        while(nums1.size() > 0) {
            map[nums1.remove(nums1.size()-1)]++;
        }
        ArrayList<Integer> set = new ArrayList<>();
        while(nums2.size() != 0) {
            int tmp = nums2.remove(nums2.size()-1);
            if(map[tmp]!=0) {
                map[tmp]=0;
                set.add(tmp);
            }
        }
        return set;
    }
    //3.字符消除
    //例如：bbbbb，最终输出b
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        while (in.hasNextLine()) { // 注意 while 处理多个 case
            String s = in.nextLine();
            Stack<Character> stack = new Stack<>();
            for(int i=0;i<s.length();i++) {
                if(stack.size() !=0 ) {
                    if(stack.peek() == s.charAt(i)) {
                        stack.pop();
                    }else {
                        stack.push(s.charAt(i));
                    }
                }else {
                    stack.push(s.charAt(i));
                }
            }
            StringBuilder str = new StringBuilder();
            while(stack.size()!=0) {
                str.append(stack.pop());
            }
            s = str.reverse().toString();
            if(s.length()==0) {
                System.out.println(0);
            }else {
                System.out.printf(s);
            }

        }
    }
}
